'use strict';

module.exports = {
    // 在执行数据库升级时调用的函数，创建 users 表
    up: async (queryInterface, Sequelize) => {

        const {  STRING  ,INTEGER,DECIMAL,DATE,TEXT} = Sequelize;

        await queryInterface.createTable('t_ad', {
            id: { type: INTEGER(11), primaryKey: true, autoIncrement: true },
            admaster_id:{type:DECIMAL(20),'allowNull': false},
            name:{type:STRING(20),'allowNull': false},
            url:{type:STRING(255),'allowNull': false},
            ad_des:{type:STRING(20),'allowNull': false},
            createtime:{type:DATE},
            modifytime:{type:DATE},
            deadline:{type:DATE},
            budget:{type:DECIMAL(10),'allowNull': false},
            price:{type:DECIMAL(10),'allowNull': false},
            person_limit:{type:DECIMAL(10),'allowNull': false},
            isshow:{type:DECIMAL(1),'allowNull': false},
            checkinfo:{type:TEXT,'allowNull': false},
            area:{type:STRING(200),'allowNull': false},
            state:{type:DECIMAL(1),'allowNull': false},
            isdelete:{type:DECIMAL(1),'allowNull': false},
            usedpercent:{type:DECIMAL(3),'allowNull': false},
        },{
            timestamps: false,  //去除createAt updateAt
            freezeTableName: true,  //使用自定义表名
        });
    },
    // 在执行数据库降级时调用的函数，删除 users 表
    down: async queryInterface => {
        await queryInterface.dropTable('t_ad');
    },
};
